package com.gagakuai.bpm.demo.messageEvent.customer;

import lombok.extern.slf4j.Slf4j;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Component;

/*
 * @program: bpm_server
 * @description: 客户发起付款消息
 * @author: houhong
 * @create: 2022-07-21 22:18
 */
@Slf4j
@Component(value = "custmerPayDelagte")
public class CustmerPayDelagte implements JavaDelegate {

    @Override
    public void execute(DelegateExecution delegateExecution) throws Exception {

        //发送客户端付款消息 发送businessKey =  "messageBusinessKey"上
        delegateExecution.getProcessEngineServices()
                .getRuntimeService()
                .createMessageCorrelation("Message_payment")
                .processInstanceBusinessKey("messageBusinessKey")
                .correlate();
    }
}